//
//  FunctionalDepartmentService.m
//  HZHome
//
//  Created by SunShine on 13-10-10.
//  Copyright (c) 2013年 xzysun. All rights reserved.
//

#import "FunctionalDepartmentService.h"

@implementation FunctionalDepartmentService

-(id)init
{
    self = [super init];
    if (self) {
        _dataItemName = @"CommonMineQueryItem";
    }
    return self;
}

-(void)loadDataWithKey:(NSString *)keyOrNil
{
    _currentPageNo = 1;//刷新或查询的时候将请求页码变为1
    if (self.dataList) {
        self.dataList = nil;
    }
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:@"1" forKey:@"categoryid"];
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"title"];
    } else {
        [params setValue:@"" forKey:@"title"];
    }
    [self doHttpPost:WOYAOCHA headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
}

-(void)loadMoreDataWithKey:(NSString *)keyOrNil
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:@"1" forKey:@"categoryid"];
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"title"];
    } else {
        [params setValue:@"" forKey:@"title"];
    }
    [self doHttpPost:WOYAOCHA headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo+1] parameters:params];
}

-(CGFloat)heightForCellAtRow:(NSIndexPath *)index
{
    return 64.0f;
}

-(void)configCell:(UITableViewCell *)cell atIndex:(NSIndexPath *)index
{
    CommonMineQueryItem *item = [self.dataList objectAtIndex:index.row];
    InfoWithPhoneAndMapCell *tempCell = (InfoWithPhoneAndMapCell*)cell;
    [self configInfoWithPhoneAndMapCell:tempCell withItem:item atIndex:index.row];
}
@end
